import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { FormBuilder, Validators } from '@angular/forms';
import { ApiService } from './../../../core/api/api.service';
import { MessageService } from './../../../core/service/message.service';
import { NzMessageService, NzModalService } from 'ng-zorro-antd';
import { EChartOption } from 'echarts';
/**
 * 资产管理
 */

@Component({
    templateUrl: './assetsMgmt.html',
    styleUrls: ['./assetsMgmt.scss']
})
export class AssetsMgmtComponent implements OnInit {
    pages = {
        pageNo: 1,
        pageSize: 5,
        total: 5,
        enterprise: '',
        area: ''
    };
    option: EChartOption = {
        color: ['#3398DB'],
        legend: {
            data: ['金融', '政府', '教育', '通信', '工业', '公共卫生']
        },
        title: {
            text: '分类统计'
        },
        textStyle: {
            fontSize: 14,
            color: '#fff'
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        xAxis: [{
            type: 'category',
            // data: ['金融', '政府', '教育', '通信','工业','公共卫生'],
            // axisTick: {
            //     show: false
            // }
        }],
        yAxis: [{
            type: 'value'
        }],
        series: [{
            name: '金融',
            type: 'bar',
            color: ['#FA9A34'],
            data: [120],
        }, {
            name: '政府',
            color: ['#F75D54'],
            type: 'bar',
            data: [820]
        }, {
            name: '教育',
            color: ['#0FB3F8'],
            type: 'bar',
            data: [320]
        }, {
            name: '通信',
            color: ['#2EDADC'],
            type: 'bar',
            data: [220]
        }, {
            name: '工业',
            color: ['#D8D8D8'],
            type: 'bar',
            data: [280]
        }, {
            name: '公共卫生',
            type: 'bar',
            data: [280]
        }]
    }
    mgOption: EChartOption = {
        series: [
            {
                type: 'pie',
                radius: [30, 110],
                center: ['50%', '50%'],
                roseType: 'area',
                legend: {
                    left: 'center',
                    top: 'bottom',
                    data: ['rose1', 'rose2', 'rose3', 'rose4', 'rose5', 'rose6', 'rose7', 'rose8']
                },
                data: [
                    { value: 10, name: 'rose1' },
                    { value: 5, name: 'rose2' },
                    { value: 15, name: 'rose3' },
                    { value: 25, name: 'rose4' },
                    { value: 20, name: 'rose5' },
                    { value: 35, name: 'rose6' },
                    { value: 30, name: 'rose7' },
                    { value: 40, name: 'rose8' }
                ]
            }
        ]
    }
    nodes = [
        {
            title: '0-0',
            key: '00',
            expanded: true,
            children: [
                {
                    title: '0-0-0',
                    key: '000',
                    expanded: true,
                    children: [
                        { title: '0-0-0-0', key: '0000', isLeaf: true },
                        { title: '0-0-0-1', key: '0001', isLeaf: true },
                        { title: '0-0-0-2', key: '0002', isLeaf: true }
                    ]
                },
                {
                    title: '0-0-1',
                    key: '001',
                    children: [
                        { title: '0-0-1-0', key: '0010', isLeaf: true },
                        { title: '0-0-1-1', key: '0011', isLeaf: true },
                        { title: '0-0-1-2', key: '0012', isLeaf: true }
                    ]
                },
                {
                    title: '0-0-2',
                    key: '002'
                }
            ]
        }]
    postList = [{
        title:'22',
        num:'45'
    },{
        title:'2234',
        num:'45'
    },{
        title:'2234',
        num:'45'
    },{
        title:'2234',
        num:'45'
    },{
        title:'2234',
        num:'45'
    }]
    selectRow: any = {};
    dataList = [
        { id: 123 },
        { id: 124 },
        { id: 125 },
        { id: 126 },
        { id: 127 },
        { id: 128 },
        { id: 129 },
        { id: 130 },
        { id: 131 },
        { id: 132 },
    ];
    tableLoading = false;
    ngOnInit() {
    }
    constructor(
        private router: Router,
        private fb: FormBuilder,
        private apiService: ApiService,
        private message: MessageService,
        private nzMessageService: NzMessageService,
        private modal: NzModalService
    ) { }
    selectThis(data) {
        this.selectRow = data;
    }
    loadList() {
        this.apiService.post('企业列表', this.pages).then((res: any) => {
            this.dataList = res.data;
        })
    }
}
